package database;

import exceptionManager.ExceptionManager;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;


/**
 *
 * @author Sonny Sandberg
 */
public class DbIniParser {

    private String DB_User;
    private String DB_Pass;
    private String database;
    private String host;
    private String port;
    
    public DbIniParser()
    {
        try 
        {
            File configFile = new File("configuration/Database.properties");
            FileInputStream inStream = new FileInputStream(configFile);
            Properties config = new Properties();
            config.load(inStream);
            DB_User = config.getProperty("DB_User");
            DB_Pass = config.getProperty("DB_Pass");
            database = config.getProperty("Database");
            host = config.getProperty("Host");
            port = config.getProperty("Port");
        } 
        catch (FileNotFoundException ex) 
        {
            ExceptionManager.handleFileNotFoundException(ex);
        } 
        catch (IOException ex) 
        {
            ExceptionManager.handleIOException(ex);
        }
    }

    public String getDB_User() 
    {
        return DB_User;
    }

    public String getDB_Pass() 
    {
        return DB_Pass;
    }

    public String getDatabase() 
    {
        return database;
    }

    public String getHost() 
    {
        return host;
    }

    public String getPort() 
    {
        return port;
    }
}